package cn.com.blueInfo.bpm.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 通用-删除状态字段（逻辑删除）
 */
@Getter
@AllArgsConstructor
public enum BaseDeleted implements BaseEnum<Integer> {

    /** 已删除（逻辑删除） */
    DELETED(1, "已删除"),
    /** 未删除（逻辑存在） */
    NOT_DELETED(0, "未删除");

    @EnumValue
    private final Integer code;

    @JsonValue
    private final String desc;

    public static BaseDeleted getByCode(Integer code) {
        return BaseEnum.getByCode(BaseDeleted.class, code);
    }

    @JsonCreator
    public static BaseDeleted fromValue(String value) {
        return BaseEnum.getByName(value, BaseDeleted.class);
    }

}
